﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Globalization;

namespace WebsiteAdmin.Salomon.ProInfo
{
    public partial class SeriesList : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DataTable dtSeries = Bll.Series.MULTIPLE(Global.ConSalomon);

                if (dtSeries.Rows.Count > 0)
                {
                    RP_Series.DataSource = dtSeries.DefaultView;
                    RP_Series.DataBind();
                }

                dtSeries.Dispose();
            }
            else
            {
                Response.Redirect("/Trace.aspx?Err=1");
            }
        }

        protected void RP_Series_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                // 找到分类Repeater关联的数据项
                DataRowView rowv = (DataRowView)e.Item.DataItem;

                Label lblCatName = ((Label)e.Item.FindControl("CatName"));
                lblCatName.Text = rowv["CatName"].ToString();
                Label lblSerName = ((Label)e.Item.FindControl("SerName"));
                lblSerName.Text = rowv["SeriesName"].ToString();
                Label lblDelLink = ((Label)e.Item.FindControl("DelLink"));


                if (Convert.ToInt32(rowv["CatValid"]) == 0)
                {   
                    lblCatName.CssClass = "del";
                    //lblSerName.CssClass = "del";
                }

                if (Convert.ToInt32(rowv["ProNum"]) == 0)
                {
                    lblDelLink.Text = "<a href=\"javascript:void(0);\" onclick=\"javascript:Del(" + rowv["PKID"] + ",'" + rowv["SeriesName"] + "');\">删除</a>";
                }
                else
                {
                    lblDelLink.Text = "--";
                }


            }
        }
    }
}
